<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "https://www.w3.org/TR/html4/loose.dtd">
<html lang="zh-CN"><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta http-equiv="Content-Language" content="zh-CN"><link href="stylesheet.css" media="all" rel="stylesheet" type="text/css">
<title>MOVE</title>
<script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?d286c55b63a3c54a1e43d10d4c203e75"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script>
</head><body class="REFENTRY">
<div>
<table summary="Header navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><th colspan="5" align="center" valign="bottom">PostgreSQL 8.2.3 中文文档</th></tr>
<tr><td width="10%" align="left" valign="top"><a href="sql-lock.html" accesskey="P">后退</a></td><td width="10%" align="left" valign="top"><a href="sql-lock.html">快退</a></td><td width="60%" align="center" valign="bottom"></td><td width="10%" align="right" valign="top"><a href="sql-notify.html">快进</a></td><td width="10%" align="right" valign="top"><a href="sql-notify.html" accesskey="N">前进</a></td></tr>
</table>
<hr align="LEFT" width="100%"></div>
<h1><a name="SQL-MOVE"></a>MOVE</h1>
<div class="REFNAMEDIV"><a name="AEN52656"></a><h2>名称</h2>MOVE&nbsp;--&nbsp;定位一个游标</div>
<a name="AEN52659"></a><a name="AEN52661"></a>
<div class="REFSYNOPSISDIV"><a name="AEN52664"></a><h2>语法</h2>
<pre class="SYNOPSIS">MOVE [ <tt class="REPLACEABLE"><i>direction</i></tt> { FROM | IN } ] <tt class="REPLACEABLE"><i>cursorname</i></tt></pre>
</div>
<div class="REFSECT1"><a name="AEN52668"></a><h2>描述</h2>
<p><tt class="COMMAND">MOVE</tt> 在不检索数据的情况下重新定位一个游标。<tt class="COMMAND">MOVE</tt> 的工作类似于 <tt class="COMMAND">FETCH</tt> 命令，但只是重定位游标而不返回行。</p>
<p>请参考 <a href="sql-fetch.html"><i>FETCH</i></a> 命令获取语法和参数的详细信息。</p>
</div>
<div class="REFSECT1"><a name="AEN52676"></a><h2>输出</h2>
<p>成功完成时，<tt class="COMMAND">MOVE</tt> 命令将返回一个下面形式的命令标签</p>
<pre class="SCREEN">MOVE <tt class="REPLACEABLE"><i>count</i></tt></pre>
<p><tt class="REPLACEABLE"><i>count</i></tt> 是一个带同参数的 <tt class="COMMAND">FETCH</tt> 命令会返回的行数(可能为零)。</p>
</div>
<div class="REFSECT1"><a name="AEN52684"></a><h2>例子</h2>
<pre class="PROGRAMLISTING">BEGIN WORK;
DECLARE liahona CURSOR FOR SELECT * FROM films;

-- 忽略开头5行:
MOVE FORWARD 5 IN liahona;
MOVE 5

-- 抓取游标liahona里的第6行:
FETCH 1 FROM liahona;
 code  | title  | did | date_prod  |  kind  |  len
-------+--------+-----+------------+--------+-------
 P_303 | 48 Hrs | 103 | 1982-10-22 | Action | 01:37
(1 row)

-- 关闭游标liahona并提交事务:
CLOSE liahona;
COMMIT WORK;</pre>
</div>
<div class="REFSECT1"><a name="AEN52687"></a><h2>兼容性</h2>
<p>SQL 标准里没有 <tt class="COMMAND">MOVE</tt> 语句。</p>
</div>
<div class="REFSECT1"><a name="AEN52691"></a><h2>又见</h2><a href="sql-close.html"><i>CLOSE</i></a>, <a href="sql-declare.html"><i>DECLARE</i></a>, <a href="sql-fetch.html"><i>FETCH</i></a></div>
<div>
<hr align="LEFT" width="100%">
<table summary="Footer navigation table" width="100%" border="0" cellpadding="0" cellspacing="0">
<tr><td width="33%" align="left" valign="top"><a href="sql-lock.html" accesskey="P">后退</a></td><td width="34%" align="center" valign="top"><a href="index.html" accesskey="H">首页</a></td><td width="33%" align="right" valign="top"><a href="sql-notify.html" accesskey="N">前进</a></td></tr>
<tr><td width="33%" align="left" valign="top">LOCK</td><td width="34%" align="center" valign="top"><a href="sql-commands.html" accesskey="U">上一级</a></td><td width="33%" align="right" valign="top">NOTIFY</td></tr>
</table>
</div>
</body></html>